package com.cndongtai.util;

import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;

public class BASE64Util {

	public static byte[] decryptBASE64(String key) throws Exception {
		return (new BASE64Decoder()).decodeBuffer(key);
	}


	public static String encryptBASE64(byte[] key) throws Exception {
		String encode = (new BASE64Encoder()).encodeBuffer(key);
		return encode.replaceAll("[\\s*\t\n\r]", "");
	}

}
